<template>
  <div>
    <div class="h-[60px] shadow-[0_0px_12px_0px_rgba(0,0,0,0.1)]">
      <div class="w-[1400px] m-auto py-[12px] flex h-full box-border">
        <div class="h-full">
          <img class="h-full" src="https://placehold.co/1200x400?text=logo" />
        </div>
        <div
          class="ml-[12px] menu-item"
          :class="path == '/' ? 'on' : ''"
          @click="goUrl('/')"
        >
          首页
        </div>
      </div>
    </div>
    <div class="w-[1400px] m-auto">
      <router-view />
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const path = ref("");
const goUrl = (url) => {
  router.push(url);
  path.value = url;
};
path.value = location.hash.replace("#", "");
</script>

<style scoped>
.menu-item {
  /* margin-left: 12px; */
  line-height: 36px;
  font-size: 14px;
  padding: 0 12px;
}
.menu-item:hover,
.menu-item.on {
  background-color: #196afb;
  color: white;
  cursor: pointer;
  border-radius: 4px;
}
</style>
